package com.hans.scala.collection

/**
 * 元祖
 * Created by Hans on 2014/4/9.
 */
object TupleExample {
  def main(args: Array[String]) {
    def longestWord(words: Array[String]) = {
      var word = words(0)
      var idx = 0
      for (i <- 1 until words.length) {
        if (words(i).length > word.length) {
          word = words(i)
          idx = i
        }
      }
      (word, idx)
    }
    val longest = longestWord("the quick brown fox".split(" "))
    println(longest)
  }
}
